import request from '@/utils/request.js'

//订单预览
export const orderPreview = () => request.get('/api/orders/preview')

//提交订单
export const subOrder = (address_id) =>
  request.post('/api/orders', {
    address_id
  })

//订单详情
export const getOrderDetail = (id) =>
  request(`/api/orders/${id}?include=orderDetails.goods,address`)

//订单列表
export const getOrderList = (
  obj = {
    page: 1,
    status: ''
  }
) =>
  request(
    `/api/orders?include=orderDetails.goods&page=${obj.page}&status=${obj.status}`
  )
